<!--_meta 作为公共模版分离出去-->
<#include "include/_meta.html">
<!--/meta 作为公共模版分离出去-->

<title>客户管理</title>
<meta name="keywords" content="汽车租赁">

</head>
<body>
<article class="page-container">
    <form class="form form-horizontal" id="form-admin-add">

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>客户名称：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="" placeholder="" id="custormerName" name="custormerPhone"
                       autocomplete="off">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>手机号：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="" placeholder="" id="custormerPhone" name="custormerPhone">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>身份证号：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="" placeholder="" id="custormerIdCard"
                       name="custormerIdCard">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>驾驶证号：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="" placeholder="" id="custormerDriveCard"
                       name="custormerDriveCard">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>客户类别：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="" placeholder="" id="custormerCategory"
                       name="custormerCategory">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>客户公司号码：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="" placeholder="" id="custormerCompanyId"
                       name="idcarcustormerCompanyIdd">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>客户机构代码：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="" placeholder="" id="custormerCompanyCode"
                       name="custormerCompanyCode">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>客户税务证号码：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="" placeholder="" id="custormerCompanyTaxIIdCard"
                       name="custormerCompanyTaxIIdCard">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>客户状态：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="" placeholder="" id="custormerState" name="custormerState">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>黑名单备注：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="" placeholder="" id="custormerStateRemark"
                       name="custormerStateRemark">
            </div>
        </div>

        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>信用值：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="" placeholder="" id="custormerCreditValue"
                       name="custormerCreditValue">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>会员等级：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="" placeholder="" id="custormerVipLevel"
                       name="custormerVipLevel">
            </div>
        </div>

        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                <input id="saveButton" class="btn btn-primary radius" type="button" value="&nbsp;&nbsp;提交&nbsp;&nbsp;"/>
                <input id="cancelButton" class="btn btn-primary radius" type="button" value="&nbsp;&nbsp;取消&nbsp;&nbsp;""/>
            </div>
        </div>

    </form>
</article>

<!--_footer 作为公共模版分离出去-->
<#include "include/_footer.html">
<!--/_footer /作为公共模版分离出去-->

<script>
    var addCustomerInf = function () {
        if (!check().form()) {
            return;
        }

        $.ajax({
            type: 'post',
            dataType: 'json',
            url: '/addCustomerInf',
            data: {
                custormerName: $("#custormerName").val(),
                custormerPhone: $("#custormerPhone").val(),
                custormerIdCard: $("#custormerIdCard").val(),
                custormerDriveCard: $("#custormerDriveCard").val(),
                custormerCategory: $("#custormerCategory").val(),
                custormerCompanyId: $("#custormerCompanyId").val(),
                custormerCompanyCode: $("#custormerCompanyCode").val(),
                custormerCompanyTaxIIdCard: $("#custormerCompanyTaxIIdCard").val(),
                custormerState: $("#custormerState").val(),
                custormerStateRemark: $("#custormerStateRemark").val(),
                custormerCreditValue: $("#custormerCreditValue").val(),
                custormerVipLevel: $("#custormerVipLevel").val()
            },
            success: function () {
                $("#cancelButton").click();
            }
        });
    };

    $("#saveButton").click(function () {
        addCustomerInf();
    });


    $("#cancelButton").click(function () {
        var index = parent.layer.getFrameIndex(window.name);
        parent.getAllCustomerInf();
        parent.layer.close(index);
    });

    //非空校验
    function check() {
        return $("#form-admin-add").validate({
            rules: {
                custormerName: {
                    required: true
                },
                custormerPhone: {
                    required: true
                },
                custormerIdCard: {
                    required: true
                },
                custormerDriveCard: {
                    required: true
                },

                custormerCategory: {
                    required: true
                },
                custormerCompanyId: {
                    required: true
                },
                custormerCompanyCode: {
                    required: true
                },
                custormerCompanyTaxIIdCard: {
                    required: true
                },
                custormerState: {
                    required: true
                },
                custormerStateRemark: {
                    required: true
                },
                custormerCreditValue: {
                    required: true
                },
                custormerVipLevel: {
                    required: true
                }
            },

            message: {
                custormerName: {
                    required: ""
                },
                custormerPhone: {
                    required: ""
                },
                custormerIdCard: {
                    required: ""
                },
                custormerDriveCard: {
                    required: ""
                },

                custormerCategory: {
                    required: ""
                },
                custormerCompanyId: {
                    required: ""
                },
                custormerCompanyCode: {
                    required: ""
                },
                custormerCompanyTaxIIdCard: {
                    required: ""
                },
                custormerState: {
                    required: ""
                },
                custormerStateRemark: {
                    required: ""
                },
                custormerCreditValue: {
                    required: ""
                },
                custormerVipLevel: {
                    required: ""
                }
            }
        });
    }
</script>


<!--请在下方写此页面业务相关的脚本-->
<#--<script type="text/javascript">
$(function(){

	$('.skin-minimal input').iCheck({
		checkboxClass: 'icheckbox-blue',
		radioClass: 'iradio-blue',
		increaseArea: '20%'
	});
	
	$("#form-admin-add").validate({
		rules:{
			adminName:{
				required:true,
				minlength:2,
				maxlength:16
			},
			
			sex:{
				required:true,
			},
			mobile:{
				required:true,
				isMobile:true,
			},
			
			adminRole:{
				required:true,
			},
		},
		onkeyup:false,
		focusCleanup:true,
		success:"valid",
		submitHandler:function(form){
			
	   		$.ajax({
	            type: 'post', 
				contentType:"application/json", 
	            url: '/addClient1', 
	            data:JSON.stringify({
						'name': $("#name").val()+'',
						'uid': $("#uid").val(),
		                'mobile': $("#mobile").val(),
		               	'sex': $("#sex").val(),
						'idcard': $("#idcard").val(),
						'drivernum': $("#drivernum").val(),
		                'companyid': $("#companyid").val(),
		               	'creditnum': $("#creditnum").val(),
						'memlevel': $("#memlevel").val(),
						'clientstate': $("#clientstate").val(),
		                'remark': $("#remark").val()
						}),
	            success:function(data){ 
	 				console.log('提交成功！');
	 				var index = parent.layer.getFrameIndex(window.name);
					parent.$("#searchUsers").click();
					parent.layer.close(index);
	            }
	
	        });

			
		}
	});
});
</script> -->
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>